﻿using Microsoft.AspNetCore.Http;

namespace TianYu.Core.Common.Extension
{
    public static class HttpContextExtension
    {
        /// <summary>获取客户端IP</summary>
        public static string GetClientIpAddress(this HttpContext @this) => @this.Connection?.RemoteIpAddress?.ToString();

        /// <summary>获取客户端IP所在城市</summary>
        //public static string GetClientIpCity(this HttpContext @this) => @this.Connection?.RemoteIpAddress?.ToString().IPConvertAddr();
    }
}
